home *** CD-ROM | disk | FTP | other *** search
- ##########################################################
- # GDIdB demo script (c) 1997 Global Data Industries
- #
- # This script will time the time it takes you to evaluate
- # an arithmetic expression, and test the answer to see if
- # it's correct.
- ##########################################################
-
-
-
-
-
- ##########################################################
- # declare variables used by script
-
- &defvar(?var1?,?test?,?timeval?,?oldtime?,?time?)
-
-
-
-
-
- ##########################################################
- # Print the information screen
-
- &cls
- &print("Calculation Test Demo Script")
- &print("------------------------------------------")
-
-
-
-
-
- ##########################################################
- # start script main execution loop
-
- &do
- {
- # get the current time in seconds
- &assign(?oldtime?,?gdidbtime.h?*60*60+?gdidbtime.m?*60+?gdidbtime.s?)
-
- # get the user's answer to the problem
- &assign(?var1?,"quit")
- &input(?var1?,"What's 2+6*8\?")
-
- # get the new time (in seconds)
- &assign(?timeval?,?gdidbtime.h?*60*60+?gdidbtime.m?*60+?gdidbtime.s?)
-
- # calculate the time taken to respond (in seconds)
- &assign(?time?,?timeval?-?oldtime?)
-
- # check that ?var1? does not equal "quit"
- &strtrim(?var1?,"?var1?")
- &strcmp(?test?,"?var1?",ne,"quit",AND,"?var1?",ne,"")
- &if(?test?)
- {
- &if(?var1?==2+6*8)
- {
- &print("Correct!")
- &if(?time?<4)
- {
- &print("You took ?time? seconds to answer- that was quick!")
- }
- &else
- {
- &print("You were a bit slow though. (?time? seconds)")
- }
-
- # user got it right, so end script
- &print
- &break
- }
- &else
- {
- &print("Wrong!")
- }
- }
- &else
- {
- &print("What's wrong- too complicated for you\? ;-)")
- &print("You took ?time? seconds to think about that.")
- }
-
- &msgbox(?var1?,"Do you want another go\?",yesno,iconquestion)
- &cls
-
- } &while (?var1?==6)
-